<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script type="text/javascript" src="jquery/js/jquery-1.3.2.min.js"></script>
        <script type="text/javascript">
            function hasSameName() {
                if($("#sudokuerName").val()=="")
                    return;
                var url = "register/hasSameNameAction";
                var param = {sudokuerName:$("#sudokuerName").val()};
                //alert(param.sudokuerName);
                $.getJSON(
                    url,
                    param,
                    function(data){
                        var flag = eval("("+data+")");
                        alert(flag.has);
                    }
                );
            }
        </script>
        
        <title>Insert title here</title>
    </head>
    <body>
        <s:form id="register" namespace="/register" action="registerAction" method="post">
            <s:textfield id="sudokuerName" key="sudokuerName" label="名称" onblur="hasSameName()"/>
            <s:password id="password" key="password" label="密码"/>
            <s:textfield id="nation" key="nation" label="国家"/>
            <s:textfield id="age" key="age" label="年龄"/>
            <s:textfield id="sudokuAge" key="sudokuAge" label="游戏年龄"/>
            <s:submit value="提交"/>
        </s:form>
    </body>
</html>